<!DOCTYPE HTML>
<html>

<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <!--[if lt IE 9]-->
    <script type="text/javascript" src="../../../lib/html5shiv.js?rev=@@hash"></script>
    <script type="text/javascript" src="../../../lib/respond.min.js?rev=@@hash"></script>
    <!--[endif]-->
    <link rel="stylesheet" type="text/css" href="../../../static/h-ui/css/H-ui.min.css" />
    <link rel="stylesheet" type="text/css" href="../../../static/h-ui.admin/css/H-ui.admin.css" />
    <link rel="stylesheet" type="text/css" href="../../../lib/Hui-iconfont/1.0.8/iconfont.css" />
    <link rel="stylesheet" type="text/css" href="../../../static/h-ui.admin/skin/default/skin.css" id="skin" />
    <link rel="stylesheet" type="text/css" href="../../../static/h-ui.admin/css/style.css" />
    <link rel="stylesheet" type="text/css" href="../../../ht-css/Project.css" />
    <link rel="stylesheet" type="text/css" href="../../../ht-css/style-q.css" />
    <!--[if IE 6]-->
    <script type="text/javascript" src="../../../lib/DD_belatedPNG_0.0.8a-min.js?rev=@@hash"></script>
    <script>
        DD_belatedPNG.fix('*');
    </script>
    <!--[endif]-->
    <title>ios版本号管理</title>
</head>

<body data-id="574">
    <nav class="breadcrumb">运营管理
        <span class="c-gray en">&gt;</span> 移动端管理
        <span class="c-gray en">&gt;</span> 专题管理
        <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px ;display:block" href="javascript:location.replace(location.href);"
            title="刷新">
            <i class="Hui-iconfont">&#xe68f;</i>
        </a>
    </nav>
    <article class="page-container">
        <form class="ml-20 mr-20" id="form-member" method="post">
            <div class="bk-gray bg-1 pd-20">
                <div class="pl-10 lh-30 mb-10">
                    <div class="line mb-10"></div>
                    <table class="table-hover table_li ml-10 mb-10 table">
                        <thead class="text-l">
                            <tr>
                                <td class="col-6-1">
                                    <div class="row ml-10">
                                        <label class="form-label f-l pt-5 text-r w-80">专题名称/ID：</label>
                                        <div class="formControls col-xs-8 col-sm-9">
                                            <input autocomplete="off"  type="text" onkeyup="fsorderlist(1)" maxlength="20" class="input-text radius w-180 f-l" id="specialname" name="specialname"
                                                placeholder="请输入专题名称/ID">
                                        </div>
                                    </div>
                                </td>
                                <td class="col-6-1">
                                    <div class="row ml-10">
                                        <label class="form-label f-l pt-5 text-r w-85" style="width: 75px;">创建时间：</label>
                                        <div class="f-l ml-10">
                                            <input onfocus="WdatePicker({ maxDate:'#F{$dp.$D(\'timemax\')||\'%y-%M-%d\'}',startDate:'%y-%M-01 00:00:00',dateFmt:'yyyy-MM-dd HH:mm:ss'})"
                                                class="input-text Wdate radius" id="timemin" type="text" placeholder="请选择时间"
                                                style="width:139px;" autocomplete="off"> ~
                                            <input onfocus="WdatePicker({ minDate:'#F{$dp.$D(\'timemin\')}',dateFmt:'yyyy-MM-dd HH:mm:ss'})" class="input-text Wdate radius"
                                                id="timemax" type="text" placeholder="请选择时间" style="width:139px;" autocomplete="off">
                                        </div>
                                    </div>
                                </td>
                            </tr>
                        </thead>
                    </table>
                </div>
                <div class="text-c pb-20 pt-10">
                    <input type="button" onclick="fsorderlist(1)" class="btn btn-secondary radius size-S " value="搜&nbsp;&nbsp;索">
                    <input name="" type="reset" class="btn radius size-S ml-10" value="重&nbsp;&nbsp;置">
                    <a class="btn btn-secondary radius size-S ml-10" href="javascript:;" id="lkkk" onclick="jumpPage()">+添加专题</a>

                </div>

                <table class="table table-border table-bg table-hover table-sort mt-10" id="table">
                    <thead class="text-c">
                        <tr>
                            <th>序号</th>
                            <th>专题名称</th>
                            <th>顶部标题</th>
                            <th>专题ID</th>
                            <th>创建时间</th>
                            <th>更新时间</th>
                            <th>操作人员</th>
                            <th>操作</th>
                        </tr>
                    </thead>
                    <tbody id="versionTr">
                        <!-- <tr role="row" class="odd">
                            <td>1</td>
                            <td>upuums983932</td>
                            <td>13426417961</td>
                            <td>PC端</td>
                            <td>网络销售中心</td>
                            <td>2020-03-31
                                <br>16:31:15</td>
                            <td>
                                <div class="action" id="action131424">
                                    <a class="183" style="margin-right: 20px">
                                        <span class="list" id="131424" onclick="Closes(131424)">删除</span>
                                    </a>
                                    <a class="184">
                                        <span class="list" onclick="detailmoban('会员','commomCustomer_see.html','131424')">编辑</span>
                                    </a>

                                </div>
                            </td>
                </tr> -->
                </tbody>
                </table>
                <div class="dataTables_wrapper goods_fanye clearfix mt-5">
                    <div class="f-r pageturning M-box3"></div>
                </div>
                <div class="mt-40"></div>
            </div>
        </form>

    </article>
    <!--_footer 作为公共模版分离出去-->
    <script type="text/javascript" src="../../../lib/jquery/1.9.1/jquery.min.js?rev=@@hash"></script>
    <script type="text/javascript" src="../../../lib/layer/2.4/layer.js?rev=@@hash"></script>
    <script type="text/javascript" src="../../../static/h-ui/js/H-ui.min.js?rev=@@hash"></script>
    <script type="text/javascript" src="../../../static/h-ui.admin/js/H-ui.admin.js?rev=@@hash"></script>
    <!--/_footer 作为公共模版分离出去-->
    <script type="text/javascript" src="../../../lib/My97DatePicker/4.8/WdatePicker.js?rev=@@hash"></script>
    <!--表单验证-->
    <script type="text/javascript" src="../../../lib/jquery.validation/1.14.0/jquery.validate.js?rev=@@hash"></script>
    <script type="text/javascript" src="../../../lib/jquery.validation/1.14.0/validate-methods.js?rev=@@hash"></script>
    <script type="text/javascript" src="../../../lib/jquery.validation/1.14.0/messages_zh.js?rev=@@hash"></script>
    <script type="text/javascript" src="../../../lib/datatables/1.10.0/jquery.dataTables.min.js?rev=@@hash"></script>
    <script type="text/javascript" src="../../../lib/laypage/1.2/laypage.js?rev=@@hash"></script>
    <script src="../../../ht-js/frame/doT.min.js?rev=@@hash"></script>
    <script src="../../../ht-js/public.js?rev=@@hash"></script>
<!--验证token-->
<script src="../../../ht-js/verifyToken.js?rev=@@hash"></script>
    <!--引入分页-->
    <link rel="stylesheet" href="../../../lib/pagination/pagination.css">
    <script src="../../../lib/pagination/jquery.pagination.js?rev=@@hash"></script>
    <link type="text/css" rel="stylesheet" href="../../../ht-js/operation-js/time-js/jedate.css">
    <script type="text/javascript" src="../../../ht-js/operation-js/time-js/jquery.jedate.js?rev=@@hash"></script>
    <!--权限控制-->
    <script type="text/javascript" src="../../../ht-js/power.js?rev=@@hash"></script>
    <script>
        var comPageNum = 1;
        fsorderlist(1);
        function fsorderlist(pageNum) {
            comPageNum = pageNum;
            $.ajax({
                url: root.special.searchAfterWheelSubjectList, //'https://'+ window.location.host +'/astore/searchAfterWheelSubjectList',//
                cache: false, //禁用缓存
                type: "POST",
                dataType: "json",
                contentType: "application/json",
                data: JSON.stringify({
                    "pageSize": 30,
                    "pageNum": pageNum,
                    "subjectName": $("#specialname").val(), //专题名称
                    "startTime": $("#timemin").val(), //生效时间开始
                    "endTime": $("#timemax").val() //结束时间
                    /*专题id参数*/
                }),
                success: function (obj) {
                    if(obj.data.list.length==0&&comPageNum!=1){
                        fsorderlist(comPageNum-1);
                        return;
                    }
                    couponlist(obj.data, 0);
                    var kk = ""
                    if (obj.data != null) {
                        kk = obj.data.pages
                    } else {
                        kk = 0
                    }
                    $('.M-box3').pagination({
                        pageCount:kk,
                        current:pageNum,
                        jump: true,
                        coping: true,
                        prevContent: '上页',
                        nextContent: '下页',
                        callback: function (api) {
                            comPageNum = api.getCurrent();
                            fsorderlist(api.getCurrent());
                        }
                    });
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    $.Huimodalalert(XMLHttpRequest, 1000);
                }
            })
        }
        var dataSource = new Array();
        //table的数据源
        var table; //table对象
        dataSource = [];
        function couponlist(data, index) {
            dataSource.splice(0, dataSource.length); //清空数组
            if (data != null && data != '') {
                var datashu = data.startRow;
                $.each(data.list, function (i, field) {
                    $("#versionTr").find('tr').attr('dataid', field.id)

                    var datashus = datashu++
                        var rowData = new Array();
                    rowData.push(datashus);
                    rowData.push(field.subName);
                    rowData.push(field.subTitle);
                    rowData.push(field.subId);
                    rowData.push(field.createTime);
                    rowData.push(field.updateTime);
                    rowData.push(field.userName);
                    rowData.push(field.subId);
                    rowData.push(field.id);
                    dataSource.push(rowData);

                });
            }
            initDataTable(dataSource);
            function initDataTable(dataSource) {
                var dttable = $('#table').dataTable(); // 初始化dataTable，清空上一个值
                dttable.fnClearTable(); //清空一下table
                dttable.fnDestroy(); //还原初始化了的datatable
                $("#table").DataTable({
                    // "order": false,
                    "autoWidth": false,
                    "ordering": false,
                    "searching": false,
                    "paging": false,
                    "retrieve": true,
                    "destroy": true,
                    "bAutoWidth": true,
                    "bLengthChange": true,
                    "aLengthMenu": false,
                    "oLanguage": {
                        "sLengthMenu": "每页显示 _MENU_ 条记录",
                        "sZeroRecords": "抱歉， 没有找到",
                        "sInfo": "从 _START_ 到 _END_ /共 _TOTAL_ 条数据",
                        "sInfoEmpty": "没有数据",
                        "sInfoFiltered": "(从 _MAX_ 条数据中检索)",
                        "oPaginate": {
                            "sFirst": "首页",
                            "sPrevious": "前一页",
                            "sNext": "后一页",
                            "sLast": "尾页"
                        },
                        "sZeroRecords": "没有检索到数据",
                    },
                    data: dataSource,
                    columnDefs: [{
                            "visible": true,
                            "targets": 0
                        },
                        {
                            "render": function (data, type, row, meta) {
                                var val = row[0]
                                if (val == undefined) {
                                    val = ''
                                }
                                return val;
                            },
                            "targets": 0
                        },
                        {
                            "render": function (data, type, row, meta) {
                                var val = row[1]
                                if (val == undefined) {
                                    val = ''
                                }
                                return val;
                            },
                            "targets": 1
                        },

                        {
                            "render": function (data, type, row, meta) {
                                var val = row[2]
                                if (val == undefined) {
                                    val = ''
                                }
                                return val;
                            },
                            "targets": 2
                        },
                        {
                            "render": function (data, type, row, meta) {
                                var val = row[3]
                                if (val == undefined) {
                                    val = ''
                                }
                                return val;
                            },
                            "targets": 3
                        },
                        {
                            "render": function (data, type, row, meta) {
                                var val = row[4]
                                if (val == undefined) {
                                    val = ''
                                }
                                return val;
                            },
                            "targets": 4
                        },

                        {
                            "render": function (data, type, row, meta) {
                                var val = row[5]
                                if (val == undefined) {
                                    val = ''
                                }
                                return val;
                            },
                            "targets": 5
                        },
                        {
                            "render": function (data, type, row, meta) {
                                var val = row[6]
                                if (val == undefined) {
                                    val = ''
                                }
                                return val;
                            },
                            "targets": 6
                        },

                        {
                            "render": function (data, type, row, meta) {
                                var val = '<a onclick="deletfn(\'' + row[8] +
                                    '\')">删除</a>&nbsp&nbsp<a onclick="jumpPage(\'' + row[7] +
                                    '\')">编辑</a>'
                                return val;
                            },
                            "targets": 7
                        },

                    ]
                });
                //权限控制函数
                power()
            }
        }
        //点击编辑跳转对应的详情模板detailmoban()
        function jumpPage(id) {
            var curTit = '添加专题';
            var curLink = './moban.html';
            if(id){
                curTit = '编辑专题';
                curLink = './moban.html?id=' + id;
            }
            var index = layer.open({
                title: curTit,
                type: 2,
                content: curLink
            });
            layer.full(index);
        }
        //删除专题模板
        function deletfn(mobanid) {
            var curInd = layer.confirm(
                '<span>确认要删除吗？</span>' + '<br/>', {
                    title: '提示',
                    btn: ['确定', '取消']
                },
                function (index) {
                    web.doAjax(root.special.removeSubject, 'post', {
                        "id": mobanid
                    }, succCallBack)
                    layer.close(curInd);
                },
                function () {
                    layer.close(curInd);
                });
        }
        function succCallBack(data) {
            if (data.errorCode == 0) {
                $.Huimodalalert('删除成功', 2000);
                fsorderlist(comPageNum)
            } else {
                $.Huimodalalert(data.msg, 2000);
            }
        }
    </script>
</body>
</html>